<template>
	<view class="center">
		<view class="container">
			<image class="dot" src="../../../static/logo.png" style="width: 92px;height: 92px;border-radius: 50px;"></image>
			<view class="pulse"></view>
			<view class="pulse1"></view>
			<view class="prize-flying" >
				<view v-for="(item,index) in flyLeftList" class="fly-prize fly-left" 
				:style="{ 'background': 'url('+ item.img +')', '-webkit-animation-duration': flySpeed + 's','animation-duration': flySpeed + 's' }"></view>
				<view v-for="(item,index) in flyCenterList" class="fly-prize fly-center"
				:style="{ 'background': 'url('+ item.img +')', '-webkit-animation-duration': flySpeed + 's','animation-duration': flySpeed + 's' }"></view>
				<view v-for="(item,index) in flyRightList" class="fly-prize fly-right"
				:style="{ 'background': 'url('+ item.img +')', '-webkit-animation-duration': flySpeed + 's','animation-duration': flySpeed + 's' }"></view>
			</view>
		</view>
		<view class="flex justify-center items-center match-button">
			<view class="match-btn">
				心动匹配
			</view>
		</view>
    </view>
</template>

<script>
	export default {
		data() {
			return {
				flyLeftList: [],
				flyCenterList: [],
				flyRightList: [],
				userList:[],
				flySpeed: 25,
				indexRecord: 0,
				intervalTime: 2,
				interval: null,
			};
		},
		// 从后台进入前台显示
		onShow() {
			this.flyLeftList=[];
			this.flyCenterList=[];
			this.flyRightList=[];
			this.refreshUser();
		},
		// 从前台进入后台
		onHide() {
			this.flyLeftList=[];
			this.flyCenterList=[];
			this.flyRightList=[];
			clearInterval(this.interval);
		},
		methods:{
			refreshUser(){
				this.flyInterval();
			},
			flyInterval() {
				if(this.interval != null){
					clearInterval(this.interval);
				}
				var t = this;
				this.pushFlyList(),
				this.interval = setInterval((function() {
					t.pushFlyList()
				}
				), 1e3 * this.intervalTime)
			},
			pushFlyList() {
				var t = 0;
				while (t < 3) {
					this.indexRecord == this.userList.length - 1 ? this.indexRecord = 0 : this.indexRecord++;
					var a = this.userList[this.indexRecord];
					if(this.$utils.isNotEmpty(a)){
						if(this.$utils.isEmpty(a.img)){
							a.img = '/static/img/logo.png';
						}
						switch (t) {
							case 0:
								this.flyLeftList.push(a);
								break;
							case 1:
								this.flyCenterList.push(a);
								break;
							case 2:
								this.flyRightList.push(a);
								break
						}
					}
					t++	
				}
			},
		}
	}
</script>

<style lang="scss">
page{
	height: 100%;
	background: url('~@/static/imgs/home/bg.png');
}
.match-button{
	background-image: linear-gradient(to top, #c471f5 0%, #fa71cd 100%);
	color: #ffff;
	border-radius: 100rpx;
	padding: 20rpx;
}
.center {
	height: 100%;
	flex: auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	//background-color: red;
	
}
@keyframes warn {
	0% {
		transform: scale(0.3);
		-webkit-transform: scale(0.3);
		opacity: 0.0;
	}

	25% {
		transform: scale(0.3);
		-webkit-transform: scale(0.3);
		opacity: 0.1;
	}

	50% {
		transform: scale(0.5);
		-webkit-transform: scale(0.5);
		opacity: 0.3;
	}

	75% {
		transform: scale(0.8);
		-webkit-transform: scale(0.8);
		opacity: 0.5;
	}

	100% {
		transform: scale(1);
		-webkit-transform: scale(1);
		opacity: 0.0;
	}
}

@keyframes warn1 {
	0% {
		transform: scale(0.3);
		-webkit-transform: scale(0.3);
		opacity: 0.0;
	}

	25% {
		transform: scale(0.3);
		-webkit-transform: scale(0.3);
		opacity: 0.1;
	}

	50% {
		transform: scale(0.3);
		-webkit-transform: scale(0.3);
		opacity: 0.3;
	}

	75% {
		transform: scale(0.5);
		-webkit-transform: scale(0.5);
		opacity: 0.5;
	}

	100% {
		transform: scale(0.8);
		-webkit-transform: scale(0.8);
		opacity: 0.0;
	}
}
.container {
	position: relative;
	width: 96px;
	height: 96px;
	/*border: 1px solid #000; hovertree.com */
}
/* 保持大小不变的小圆圈 何问起 */
.dot {
	position: absolute;
	width: 92px;
	height: 92px;
	//left: -2.5px;
    //top: -2.5px;
	-webkit-border-radius: 50%;
	-moz-border-radius: 50%;
	//border: 2px solid red;
	border-radius: 50%;
	z-index: 2;
	animation: msClock 1.8s linear infinite; 
}
@keyframes msClock{ 
	0%,90%,100%{ transform: rotate(0) scale(1);}
	20%,40%{ transform: rotate(-15deg) scale(1.1);}
	30%,50%{ transform: rotate(15deg) scale(1.1);}
}
/* 产生动画（向外扩散变大）的圆圈  */
.pulse {
	position: absolute;
	width: 320px;
	height: 320px;
    left: -120px;
    top: -120px;
	border: 6px solid $dating-color-primary;
	-webkit-border-radius: 50%;
	-moz-border-radius: 50%;
	border-radius: 50%;
	z-index: 1;
	opacity: 0;
	-webkit-animation: warn 2s ease-out;
	-moz-animation: warn 2s ease-out;
	animation: warn 2s ease-out;
	-webkit-animation-iteration-count: infinite;
	-moz-animation-iteration-count: infinite;
	animation-iteration-count: infinite;
	box-shadow: 1px 1px 30px $dating-color-primary;
}

.pulse1 {
	position: absolute;
	width: 320px;
	height: 320px;
    left: -120px;
    top: -120px;
	border: 6px solid $dating-color-primary;
	-webkit-border-radius: 50%;
	-moz-border-radius: 50%;
	border-radius: 50%;
	z-index: 1;
	opacity: 0;
	-webkit-animation: warn1 2s ease-out;
	-moz-animation: warn1 2s ease-out;
	animation: warn1 2s ease-out;
	-webkit-animation-iteration-count: infinite;
	-moz-animation-iteration-count: infinite;
	animation-iteration-count: infinite;
	box-shadow: 1px 1px 30px $dating-color-primary;
}
a{color:blue;text-decoration:none;}
.match-button{
	position: fixed;
	bottom: calc(var(--status-bar-height) + 120rpx);
}
.prize-flying{
	z-index:99;
	width:100px;
	position:absolute;
	bottom:50%;
	left:50%;
	-webkit-transform:translateX(-50%);
	transform:translateX(-50%)
}
.prize-flying .fly-prize {
	text-align:center;
	position:absolute;
	top:100%;
	opacity:0;
	width:39px;
	height:39px;
	background-repeat:no-repeat!important;
	background-size:100% 100%!important;
	border-radius:50%;
	background:#fff;
	border:1px solid #3277ff;
	padding:7px
}
.prize-flying .fly-left {
	left:0;
	z-index:5;
	animation:flyleft-data-v-1a236634
}
.prize-flying .fly-center {
	left:30px;
	z-index:3;
	animation:flycenter-data-v-1a236634
}
.prize-flying .fly-right {
	right:0;
	z-index:5;
	animation:flyright-data-v-1a236634
}

@keyframes flyleft-data-v-1a236634 {
	0% {
		-webkit-transform:scale(0) translateX(0);
		transform:scale(0) translateX(0);
		opacity:.6
	}
	5% {
		-webkit-transform:scale(1) translateX(0) translateY(-80%);
		transform:scale(1) translateX(0) translateY(-80%);
		opacity:.8
	}
	20% {
		opacity:1
	}
	30% {
		opacity:.2
	}
	32% {
		opacity:0;
		visibility:hidden
	}
	50% {
		-webkit-transform:scale(1.9) translateX(-40px) translateY(-340%);
		transform:scale(1.9) translateX(-40px) translateY(-340%)
	}
	100% {
		-webkit-transform:translateX(-100px);
		transform:translateX(-100px)
	}
}

@keyframes flycenter-data-v-1a236634 {
	0% {
		-webkit-transform:scale(0) translateX(0);
		transform:scale(0) translateX(0);
		opacity:.6
	}
	5% {
		-webkit-transform:scale(1) translateX(0) translateY(-80%);
		transform:scale(1) translateX(0) translateY(-80%);
		opacity:.8
	}
	20% {
		opacity:1
	}
	30% {
		opacity:.2
	}
	32% {
		opacity:0;
		visibility:hidden
	}
	34% {
		opacity:0
	}
	50% {
		-webkit-transform:scale(1.9) translateX(0) translateY(-340%);
		transform:scale(1.9) translateX(0) translateY(-340%)
	}
	100% {
		-webkit-transform:translateX(0);
		transform:translateX(0)
	}
}

@keyframes flyright-data-v-1a236634 {
	0% {
		-webkit-transform:scale(0) translateX(0);
		transform:scale(0) translateX(0);
		opacity:.6
	}
	5% {
		-webkit-transform:scale(1) translateX(0) translateY(-80%);
		transform:scale(1) translateX(0) translateY(-80%);
		opacity:.8
	}
	20% {
		opacity:1
	}
	30% {
		opacity:.2
	}
	32% {
		opacity:0;
		visibility:hidden
	}
	34% {
		opacity:0
	}
	50% {
		-webkit-transform:scale(1.9) translateX(40px) translateY(-340%);
		transform:scale(1.9) translateX(40px) translateY(-340%)
	}
	100% {
		-webkit-transform:translateX(100px);
		transform:translateX(100px)
	}
}
</style>
